import { defaultProps } from '../../designer/schema';
import { inbiz } from '@inbiz/core';

export interface Oparetion {
  name?: string;
  type?: string;
  page?: string;
  hander?: Function;
  api?: object;
}

export interface KeyFormat {
  key: string;
  parendKey: string;
  id: string | number;
  parentId: string | number;
}

export type IProps = {
  callBackEvents?: {
    onBeforeOperationAsync?: (type: string, data?: object) => Promise<boolean>;
    onOpenData?: <T>(data: T) => T;
    onParamFormate?: <T>(param: T) => T;
    onBeforeOpen?: (type: string, data?: object) => void;
    onBeforeClose?: (type: string, data?: object) => void;
    onRequest?: <T>(param: T) => T;
    onData?: <T>(data: T) => T;
  };
  emit?: {
    /** 自动完成框选中条目时触发 */
    (type: 'onSelect', value?: string, node?: object): void;
    (type: 'onExpand', value?: Array<string>, node?: object): void;
    (type: 'onRightClick', info?: object): void;
    (type: 'onload'): void;
    (type: 'onEdit'): void;
    (type: 'onAdd'): void;
    (type: 'onClose', action: string): void;
    (type: 'onOpen', action: string): void;
    (type: 'onError'): void;
    (type: 'onDelete'): void;
    (type: 'onClick', action?: 'string'): void;
    (type: 'onSuccess', treeData?: Array<string>): void;
    (type: any, ...arg: any): void;
  };
  onChange?: Function;
  prefixCls?: string;
  className?: string;
  inbiz: inbiz;
  value?: string | number;
  sourceModel?: string;
  sourcetype?: string;
  title: any;
  selectedKeys?: string[];
  disabled?: boolean;
  readOnly?: boolean;
} & typeof defaultProps;
